package com.app.service.impl;


import com.app.mapper.ComResumeNumberMapper;
import com.app.model.ComResumeNumberModel;
import com.app.model.WorkApplyModel;
import com.app.service.ComResumeNumberService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: ***
 * @Author: N
 * @Date: 2022年11月24日10点26分
 */
@Service
public class ComResumeNumberServiceImpl implements ComResumeNumberService {

    @Autowired
    ComResumeNumberMapper comResumeNumberMapper;

    @Override
    public ComResumeNumberModel getModelByrId(int rid) {
        QueryWrapper<ComResumeNumberModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("rid", rid);
        List<ComResumeNumberModel> comResumeNumberModelList = comResumeNumberMapper.selectList(queryWrapper);
        if (comResumeNumberModelList != null&&comResumeNumberModelList.size()>0) {
            return comResumeNumberModelList.get(0);
        } else {
            return null;
        }

    }

    @Override
    public int insert(ComResumeNumberModel model) {
        return comResumeNumberMapper.insert(model);
    }

    @Override
    public void update(ComResumeNumberModel model) {
        comResumeNumberMapper.updateById(model);
    }

    @Override
    public void delete(int rid) {
        comResumeNumberMapper.deleteById(rid);
    }

    @Override
    public int getCountAll() {
        return comResumeNumberMapper.selectCount(null);
    }

    @Override
    public List<ComResumeNumberModel> getAllList() {
        List<ComResumeNumberModel> comResumeNumberModelList = comResumeNumberMapper.selectList(null);
            return comResumeNumberModelList;
    }
}
